﻿namespace Aldart.WebSockets.Server
{
    using System;
    using System.Net.Sockets;

    /// <summary>
    /// Represents a connection to the server.
    /// </summary>
    public class Client
    {
        /// <summary>
        /// Initializes a new instance of the Client class.
        /// </summary>
        /// <param name="connection">The TCP connection object for this client.</param>
        internal Client(TcpClient connection) {
        }

        /// <summary>
        /// Raised after this client has disconnected. 
        /// </summary>
        /// <remarks>
        /// This event is not synchronized, so raised events may come from different threads, 
        /// but will come in the order in which they were received.
        /// </remarks>
        public event EventHandler<ClientEventArgs> Disconnect;

        /// <summary>
        /// Raised when a message has been received from the client.
        /// </summary>
        /// <remarks>
        /// This event is not synchronized, so raised events may come from different threads, 
        /// but will come in the order in which they were received.
        /// </remarks>
        /// <seealso cref="Aldart.WebSockets.Server.Server.ClientMessage"/>
        public event EventHandler<ClientMessageEventArgs> Message;

        /// <summary>
        /// Sends a message to the client.
        /// </summary>
        /// <remarks>
        /// The message will be sent asynchronously, so this method will not block.
        /// </remarks>
        /// <param name="message">A string that will be sent to the client.</param>
        public void Send(string message) {
        }
    }
}
